package leetcode.editor.cn;
public class P374GuessNumberHigherOrLower {
    public static void main(String[] args) {
        Solution solution = new P374GuessNumberHigherOrLower().new Solution();
        
    }
    
    //leetcode submit region begin(Prohibit modification and deletion)
/** 
 * Forward declaration of guess API.
 * @param  num   your guess
 * @return 	     -1 if num is lower than the guess number
 *			      1 if num is higher than the guess number
 *               otherwise return 0
 *
 */

public class Solution {
    public int guessNumber(int n) {
        int high = n, low = 1;
        while (low <= high) {
            int mid = low + (high - low) / 2;
            int guess = guess(mid);
            if (guess == 0) {
                return mid;
            } else if (guess < 0) {
                high = mid - 1;
            } else if (guess > 0) {
                low = mid + 1;
            }
        }
        return low;
    }

    private int guess(int mid) {
        return 0;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}